<%-- 
    Document   : login
    Created on : 28/08/2011, 21:42:49
    Author     : mauricio
--%>
<%@page import="br.com.senacrs.servlet.LogonServlet"%>
<% 
   //obtem a proxima pagina que o usuário queria acessar 
   String next = request.getParameter("next") != null ? request.getParameter("next") : ""; 
%> 
    
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Controle de Usuários - Login</title>
    
    <%@ include file="/includes/includesMenu.jsp" %>
    <link rel="stylesheet" type="text/css" href="css/form.css"/>
    <script type="text/JavaScript">
        function validarCampos(form){
            if(trim(form.CampoLogin.value) == ""){
               window.alert("Informe o login!");
               return false;
            }
            if(trim(form.CampoSenha.value) == ""){
               window.alert("Informe a senha!");
               return false;
            }
            return true;
        }

        function trim(str){
            return str.replace(/^\s+|\s+$/g,"");
        }
    </script>   

</head>
<body>              
	<div id="principal">
        <div id="cabecalho">
        </div>	
        <div id="center">
            <div id="login">
                <form action="logon" method="post" onsubmit="return validarCampos(this);">
                    <div id="loginTop">
                        Para ter acesso ao sistema é preciso estar logado!
                    </div>
                    <div id="loginCampos">
                        <label for="login">Login:</label> 
                        <input type="text" id="CampoLogin" class="inputLogin" name="<%=LogonServlet.USERNAME %>"/><br/>
                        <label for="senha">Senha:</label>
                        <input type="password" id="CampoSenha" class="inputLogin" name="<%=LogonServlet.PASSWORD %>"/><br/>
                    </div>
                    
                    <div id="loginBt">
                        <table>
                            <tr>
                                <td id="btn_l"></td>
                                <td id="btn_m"><input type="submit" value="Logar"/></td>
                                <td id="btn_r"></td>
                            </tr>
                        </table>
                        <table>
                            <tr>
                                <td id="btn_l"></td>
                                <td id="btn_m"><input type="reset" value="Limpar"/></td>
                                <td id="btn_r"></td>
                            </tr>
                        </table>
                    </div>
                </form>
                <% if(request.getParameter("fail") != null && !request.getParameter("fail").equals("")){ %> 
                <div id="loginFail">
                    <% if(request.getParameter("fail").equals("1")){ %>
                        Usuário ou Senha Inválidos!
                    <% } %>
                </div>
                <% } %>
            </div>
        </div>
    </div>

</body>
    
</html>
